package com.platform.modules.alg.alglib.poj1064;

public class Poj1064 {
    private int inf = 0x3f3f3f3f;
    private static double eps = 1e-7;
    private double L[] = new double[10005];
    private int n;
    private int k;

    // 假设切割出来的绳子的长度为x，判断够不够切割
    boolean judge(double x) {
        int num = 0;
        for (int i = 0; i < n; i++)
            num += (int) (L[i] / x);
        return num >= k;
    }

    double solve() {
        double l = 0;
        double r = inf;
        while (r - l > eps) {
            double mid = (l + r) / 2;
            if (judge(mid))
                l = mid;
            else
                r = mid;
        }
        return l;
    }

    public String cal(String input) {
        String[] line = input.split("\n");
        String[] words = line[0].split(" ");
        n = Integer.parseInt(words[0]);
        k = Integer.parseInt(words[1]);
        for (int i = 0; i < n; i++) {
            L[i] = Double.parseDouble(line[i + 1]);
        }
        double ans = solve() + eps;
        return String.format("%.2f", Math.floor(ans * 100) / 100);
    }
}
